<!--{template common/header_simple_start_xh}-->
<link href="static/jstree/themes/default/style.min.css?{VERHASH}" rel="stylesheet" media="all">
<link rel="stylesheet" href="static/perfect-scrollbar/css/perfect-scrollbar.css?{VERHASH}">
<link rel="stylesheet" href="static/css/common.css?{VERHASH}">
<link href="dzz/system/css/selfilewindow.css?{VERHASH}" rel="stylesheet" media="all">
<link rel="stylesheet" href="{MOD_PATH}/css/rightmenu/style.css?{VERHASH}"/>
<link href="dzz/system/css/rightmenu.css?{VERHASH}" rel="stylesheet" media="all">
<link href="dzz/system/css/select-file.css?{VERHASH}" rel="stylesheet" media="all">
<script type="text/javascript" src="static/js/jquery.leftDrager.js?{VERHASH}"></script>
<script type="text/javascript">
    var ctrlid = '$ctrlid';
    var range = '{$range}';
    var template = '1';
    var urldefined = '{$urldefined}';
    var mulitype = '{$mulitype}';
</script>
<style type="text/css">
   .select-filecenter {
    margin: 0;
    padding: 0;
   }
   .menu {
    width: 150px;
   }
   .input-animate {
    margin-bottom: 2px;
   }
</style>
<!--{template common/header_simple_end}-->
<!--{template fileselection/listcontent}-->
<div id="contextmenu" style="display: none;">
    <!--{template fileselection/right_contextmenu}-->
</div>
<iframe id="hideframe" name="hideframe" src="about:blank" frameborder="0" marginheight="0" marginwidth="0" width="0" height="0" allowtransparency="true" style="display:none;z-index:-99999"></iframe>
<script type="text/javascript">
    var index;
    try {
        index = parent.layer.getFrameIndex(window.name);
    } catch (e) {
        showmessage('请通过lyear窗口打开', "danger", 3000, 1);
    }
    jQuery(document).ready(function (e) {
        _explorer.getConfig(MOD_URL + '&op=fileselection&template=1&do=json' + urldefined, function () {
            var typejson = _explorer.allowselecttype,
                typehtml = '', selecttype = '', selectval = '';
            for (var o in typejson) {
                var exts = typejson[o][1].join(',').toLowerCase();
                if (typejson[o][2] == 'selected') {
                    selecttype = typejson[o][0];
                    selectval = exts;
                }
                typehtml += '<li><a href="javascript:;" data-exts="' + exts + '">' + typejson[o][0] + '</a></li>';
            }
            $('.typedropup').html(typehtml);
            $('.select-style').text(selecttype).data('exts', selectval);
        });
    });
    function submitdata() {
        var data = {};
        var rid = _selectfile.selectall.icos;
        var fid = _selectfile.fid;
        var type = '{$type}';
        if (type == 1) {//保存文件
            if (rid.length) {//选择文件提示是否覆盖
                var filedata = _explorer.sourcedata.icos[rid];
                    parent.layer.confirm(__lang.js_save_recover_file.replace('{filename}', filedata.name), {skin:'lyear-skin-danger',title: '确认覆盖'}, function(index){
                        parent.layer.msg(__lang.loading_please_wait, {icon: 'smile',skin: 'bg-info',offset:'t'});
                        $.post('index.php?mod=system&op=fileselection&template=1&do=save&operation=chkperm', {
                        'path': fid
                    }, function (data) {
                        if (data['error']) {
                            parent.layer.msg(data['error'], {icon: 'error',skin: 'bg-danger',offset:'t'});
                            return false;
                        } else {
                            var fileData = _explorer.sourcedata.icos[rid];
                            data = fileData;
                            try{
                                if(typeof parent.showWindow_callback == 'function'){
                                    parent.showWindow_callback(data,'$token');
                                }
                            }catch(e){}	
                            if (parent.{$callback}) {
                                try{parent.{$callback}(data, '$token');}catch(e){}
                            }
                            parent.layer.close(index);
                            return;
                        }
                    }, 'json').fail(function (jqXHR, textStatus, errorThrown) {
                        showmessage('{lang do_failed}', 'error', 3000, 1);
                    });
				});
            } else {//未选择文件上传文件返回
                var filename = $('#savenewname').val();
                parent.layer.msg(__lang.loading_please_wait, {icon: 'smile',skin: 'bg-info',offset:'t'});
                $.post('index.php?mod=system&op=fileselection&template=1&do=ajax&operation=newIco', {
                    'fid': fid,
                    'filename': filename
                }, function (data) {
                    if (data['error']) {
                        parent.layer.msg(data['error'], {icon: 'error',skin: 'bg-danger',offset:'t'});
                        return false;
                    } else {
						try{
                            if(typeof parent.showWindow_callback == 'function'){
                                parent.showWindow_callback(data,'$token');
                            }
                        }catch(e){}	
                        if (parent.{$callback}) {
                            try{parent.{$callback}(data, '$token');}catch(e){}
                        }
                        parent.layer.close(index);
                        return;
                    }
                }, 'json').fail(function (jqXHR, textStatus, errorThrown) {
                    showmessage('{lang do_failed}', 'error', 3000, 1);
                });
            }
            return false;
        } else if (type == 2) {//选择位置时
            var fid = _selectfile.fid;
            if (!fid) {
                parent.layer.msg(__lang.please_select_dir, {icon: 'error',skin: 'bg-danger',offset:'t'});
                return false;
            } else {
                var data = _explorer.sourcedata.folder[fid];
                if(_explorer.permfilter){
                    var permfilter = _explorer.permfilter.split(',');
                    for(var o in permfilter){
                        if(permfilter[o] == 'write'){
                            permfilter[o] = 'edit';
                        }
                        if(!_explorer.Permission_Container(permfilter[o],fid)){
                            parent.layer.msg(__lang.no_privilege, {icon: 'error',skin: 'bg-danger',offset:'t'});
                            return false;
                        }
                    }
                }
                try{
					if(typeof parent.showWindow_callback == 'function'){
						parent.showWindow_callback(fid,data);
					}
				}catch(e){}	
              
                if (parent.{$callback}) {
                   try{ parent.{$callback}(fid, data);}catch(e){}
                }
                parent.layer.close(index);
            }
            return false;
        } else {//选择文件
            if (rid.length < 1) {
                parent.layer.msg(__lang.please_select_file, {icon: 'error',skin: 'bg-danger',offset:'t'});
                return false;
            } else {
                if (mulitype == '0') {
                    var fileData = _explorer.sourcedata.icos[rid];
                    data = fileData;
                    data['editperm'] = _explorer.Permission('edit', fileData);
                } else {
                    for (var o in rid) {
                        var fileData = _explorer.sourcedata.icos[rid[o]];
                        fileData['editperm'] = _explorer.Permission('edit', fileData);
                        data[rid[o]] = fileData;
                    }
                }
				try{
					if(typeof parent.showWindow_callback == 'function'){
                        parent.showWindow_callback(data,'$token');
					}
				}catch(e){}	
                if (parent.{$callback}) {
					try{
                    	parent.{$callback}(data, '$token');
					}catch(e){}	
                }
                parent.layer.close(index);
            }
            return false;
        }
        parent.layer.close(index);
        return false;
    }
</script>
<script type="text/javascript" src="dzz/system/scripts/explorer.js?{VERHASH}"></script>
<script type="text/javascript" src="static/js/jstree.min.js?{VERHASH}"></script>
<script type="text/javascript" src="static/js/imgReady.js?{VERHASH}"></script>
<script type="text/javascript" src="dzz/system/scripts/lyear_select-file.js?{VERHASH}"></script>
<script type="text/javascript" src="dzz/system/scripts/_perm.js?{VERHASH}"></script>
<script type="text/javascript" src="dzz/system/scripts/_hotkey.js?{VERHASH}"></script>
<script type="text/javascript" src="dzz/system/scripts/_select.js?{VERHASH}"></script>
<script type="text/javascript" src="dzz/system/scripts/contextmenu.js?{VERHASH}"></script>
<script type="text/javascript" src="static/perfect-scrollbar/js/perfect-scrollbar.min.js?{VERHASH}"></script>
<script type="text/javascript" src="static/js/input_field.js?{VERHASH}"></script>
<!-- The basic File Upload plugin -->
<!-- The jQuery UI widget factory, can be omitted if jQuery UI is already included -->
<script type="text/javascript" src="static/jquery_file_upload/jquery.ui.widget.js?{VERHASH}"></script>
<script type="text/javascript" src="static/jquery_file_upload/jquery.iframe-transport.js?{VERHASH}"></script>
<!-- The basic File Upload plugin -->
<script type="text/javascript" src="static/jquery_file_upload/jquery.fileupload.js?{VERHASH}"></script>
<script type="text/javascript" src="static/jquery_file_upload/jquery.fileupload-process.js?{VERHASH}"></script>
<script type="text/javascript" src="static/jquery_file_upload/jquery.fileupload-validate.js?{VERHASH}"></script>
<script type="text/javascript" src="static/perfect-scrollbar/js/perfect-scrollbar.min.js?{VERHASH}"></script>
<!-- The basic File Upload plugin -->
<script type="text/javascript" src="static/bootstrap/js/bootstrap.min.js"></script>
</body>
</html>